//
//  HLMasterViewController.m
//  CommonProject
//
//  Created by 任翰林 on 16/6/11.
//  Copyright © 2016年 任翰林. All rights reserved.
//

#import "HLMasterViewController.h"
#import "HLHomeViewController.h"
#import "HLAboutMeViewController.h"
#import "HLMySpaceViewController.h"
#import "HLPlayBarViewController.h"
#import <Masonry.h>
#import "HLButton.h"



@interface HLMasterViewController ()
@property (weak, nonatomic) IBOutlet UIView *masterContentView;
@property (nonatomic,strong)UIStackView * bottomStackView;
@property (nonatomic ,strong)UIStackView * menuStackView;

@end

@implementation HLMasterViewController
//menuStackView的懒加载
- (UIStackView *)menuStackView
{

    if (_menuStackView == nil) {
        
        _menuStackView = [[UIStackView alloc]init];
        self.menuStackView.axis = UILayoutConstraintAxisVertical;
        [self.view addSubview:self.menuStackView];
        [self.menuStackView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.view);
            make.bottom.mas_equalTo(self.bottomStackView.mas_top);
            make.right.mas_equalTo(self.view);
            make.height.mas_equalTo(200);
        }];
    }
    
    return _menuStackView;

}
//bottomStackView的懒加载
- (UIStackView *)bottomStackView
{

    if (_bottomStackView == nil) {
        
        _bottomStackView = [[UIStackView alloc]init];
        [self.view addSubview:self.bottomStackView];
        [self.bottomStackView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.view);
            make.bottom.mas_equalTo(self.view);
            make.right.mas_equalTo(self.view);
            make.height.mas_equalTo(44);
        }];
    }

    return _bottomStackView;
    
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setMenuStackView];
    [self setBottomStackView];
}

- (void)setMenuStackView
{

    NSArray * bottomData = @[
                             
                             @{@"title":@"全部动态"},
                             @{@"title":@"与我相关"},
                             @{@"title":@"照片墙"},
                             @{@"title":@"电子相册"},
                             @{@"title":@"好友"},
                             @{@"title":@"更多"},
                             
                             ];
    
    for (NSDictionary * dict in bottomData) {
        HLButton * button = [HLButton buttonWithDict:dict];
        [self.menuStackView addArrangedSubview:button];
    }
    

}

- (void)setBottomStackView
{

    NSArray * bottomData = @[
                             
                            @{@"title":@"说说"},
                            @{@"title":@"照片"},
                            @{@"title":@"日志"},
                            
    ];
    
    for (NSDictionary * dict in bottomData) {
        
        HLButton * button = [HLButton buttonWithDict:dict];
        
        [self.bottomStackView addArrangedSubview:button];
    }
    


}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//是否演示master控制器的方法，供外界调用。
-(void)isMasterContentViewShow:(BOOL)show;
{
    self.masterContentView.hidden = show;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
